package com.hannesdorfmann.mosby3.mvp.animator;

import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
import ohos.agp.animation.AnimatorProperty;
import ohos.agp.components.AttrHelper;
import ohos.agp.components.ComponentContainer;
import ohos.agp.components.Text;
import ohos.app.Context;
import org.junit.Test;
import static org.junit.Assert.*;

public class AlphaAnimatorTest {

    @Test
    public void start() {
        Context context = AbilityDelegatorRegistry.getAbilityDelegator().getAppContext();
        Text text = new Text(context);
        text.setText("测试");
        text.setTextSize(AttrHelper.fp2px(15, context));
        text.setLayoutConfig(new ComponentContainer.LayoutConfig(ComponentContainer.LayoutConfig.MATCH_CONTENT, ComponentContainer.LayoutConfig.MATCH_CONTENT));

        AnimatorProperty contentFadeIn = new AlphaAnimator(0f, 1f);
        contentFadeIn.setDuration(200);
        contentFadeIn.setTarget(text);
        contentFadeIn.start();

        assertNotNull(text);
    }
}